<template>
  <div id="app">
    <list :list="list" :single="true"></list>
    <div class="submit" @click="submit()">提交数据</div>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import List from './components/list/list.vue'
import deepTree from '@/analogData/deepTree.js'
export default {
  name: 'App',
  data() {
    return {
      list: deepTree.deps,
    }
  },
  components: {
    HelloWorld,
    List,
  },
  mounted() {
    let a = []
    localStorage.setItem('chooseClass', JSON.stringify(a))
  },
  methods: {
    submit() {
      let dept = [],
        id = [],
        org_id = []
      const chooseClass = JSON.parse(localStorage.getItem('chooseClass'))
      chooseClass.forEach((item) => {
        dept.push(item.dep.name_path)
        id.push(item.dep.id)
        org_id.push(item.dep.org_id)
      })
      console.log('选中的为', chooseClass)
    },
  },
}
</script>

<style>
.submit {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 0);
  width: 100px;
  height: 50px;
  background-color: #0dbc79;
  color: #fff;
  line-height: 50px;
  text-align: center;
}
</style>
